-
Notifications
You must be signed in to change notification settings - Fork 78
[RelatedArtists] Use layoutEvent instead of Dimensions #400
Conversation
this.state = { | ||
columns: 0, | ||
imageSize: { | ||
width: 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opaque_image_view
needs some sort of aspect ratio or dimensions to render, so I start with 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to hear suggestions though because this does feel a bit inelegant. I'm guessing this could be fixed by doing some work in the image view or by not rendering images at all until after layout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alloy ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can stay as it is for now because the image view will throw an error if you try otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah the image view wants one or the other so that it can infer if you want to resize or crop. I would say that the simplest solution here is to not render the image view yet until after the onLayout
callback is performed and e.g. columnCount > 0
.
|
||
// TODO: Document what these margins are based on. | ||
let columnCount | ||
let margins | ||
if (isPad) { | ||
if (isPadHorizontal) { | ||
columnCount = 4 | ||
margins = 140 | ||
margins = 90 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really want to make these calculated the way they are here, so that's why this is still a WIP.
Nice one! |
It seems something is up with CI (it's timing out) so I'm just gonna go ahead and merge. |
Fixes artsy/eigen#2024
I thought this was addressed but I realized it's one of those layout bugs that can only really be seen on-device. I think this is a pattern we should adopt everywhere because it really doesn't seem like
Dimensions
is a reliable source for layout.